<?php if ( ! defined("HDPHP_PATH")) {exit;} ?>
<!doctype html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Document</title>
    <link type="text/css" href="public/install/css/css.css" rel="stylesheet"/>
    <jquery/>
    <hdjs/>
</head>
<body>
    <div class="step">
        <div class="bg"></div>
        <div class="database">
            <div class="title">HDCMS 安装向导</div>
            <div class="process">
                <ul>
                    <li>许可协议</li>
                    <li>环境检测</li>
                    <li class="current">数据库设定</li>
                    <li>生成数据</li>
                    <li>安装完成</li>
                </ul>
            </div>
            <!--协议说明-->
            <form onsubmit="return false;" method="post" class="hd-form">
                <div class="check set">
                    <h3>数据库配置</h3>
                    <table>
                        <tr>
                            <td width="150">数据库主机</td>
                            <td>
                                <input type="text" name="host" value="127.0.0.1" class="hd-w200"/>
                            </td>
                        </tr>
                        <tr>
                            <td>数据库用户</td>
                            <td>
                                <input type="text" name="user" value="root" class="hd-w200"/>
                            </td>
                        </tr>
                        <tr>
                            <td>数据库密码</td>
                            <td>
                                <input type="text" name="password" value="" class="hd-w200"/>
                            </td>
                        </tr>
                        <tr>
                            <td>数据表前缀</td>
                            <td>
                                <input type="text" name="prefix" value="hd_" class="hd-w200"/>
                            </td>
                        </tr>
                        <tr>
                            <td>数据库名称</td>
                            <td>
                                <input type="text" name="database" value="hdcms" class="hd-w200"/>
                            </td>
                        </tr>
                    </table>
                </div>
                <div class="check set">
                    <h3>管理员初始密码</h3>
                    <table width="100%">
                        <tr>
                            <td width="150">超级管理员</td>
                            <td>
                                <input type="text" name="WEB_MASTER" value="admin" class="hd-w200"/>
                            </td>
                        </tr>
                        <tr>
                            <td>密　码</td>
                            <td>
                                <input type="text" name="admin_password" value="admin888" class="hd-w200"/>
                            </td>
                        </tr>
                    </table>
                </div>
                <div class="check set">
                    <h3>网站设置</h3>
                    <table width="100%">
                        <tr>
                            <td width="150">网站名称</td>
                            <td>
                                <input type="text" name="WEBNAME" value="HDCMS内容管理系统" class="hd-w200"/>
                            </td>
                        </tr>
                        <tr>
                            <td>站长邮箱</td>
                            <td>
                                <input type="text" name="EMAIL" class="hd-w200"/>
                            </td>
                        </tr>
                    </table>
                </div>
                <!--协议说明-->
                <div class="btn">
                    <button class="hd-btn" type="button" onclick="location.href='{{U('environment')}}'">上一步</button>
                    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                    <button class="hd-btn hd-btn-primary" type="button" onclick="post(this)">下一步</button>
                </div>
            </form>
        </div>
    </div>
    <script>
        function post(obj)
        {
            $.post("{{U('VerifyDatabaseParam')}}", $('form').serialize(), function (json) {
                if (json.status == 1)
                {
                    $.get("{{U('InsertTableData')}}",function(result){

                        if(result.status==1)
                        {
                            location.href ='{{U('Complete')}}';
                        }
                    },'JSON');
                }
                else
                {
                    hd_alert({
                        message: json.message,
                        timeout: 2
                    })
                }
            }, 'json');
            return false;
        }
</script>
</body>
</html>